#include <stdio.h>
int main()
{  	  		       
    int count=1;
    long  n, sum, f1, f2, f3;
    printf("Input n:");
    scanf("%ld", &n);
    if (n <= 3)//1
    {  	  		       
        f1 = 1;
        printf("count=%d\npeach=%ld\n", count, f1);
    }
    else
    {  	  		       
        count = 2;
        f1 = 1;
        f2 = 1;
        sum = f1 + f2;//1
         long curSum = 0;
        while (n - sum > 0)//1
        {  	  		       
            f3 = f1 + f2;//1
            f1 = f2;//1
            f2 = f3;//1
            
            count++;//1
             
            sum =  sum + f3;
            curSum =f3;
            if( n - sum < 0 )
            {  	  		       
                // the rest peach is assign to the current monkey,too
                 
                curSum = n - (sum - f3);
                if(curSum <= f1)
                {  	  		       
                    count = count - 1;
                    curSum = f1;
                }
                break;
            }
        }
        
       
        printf("count=%d\npeach=%ld\n", count, curSum);
    }
    return 0;
}